package com.thtf.zwdsj.systemmanage.common;

import com.thtf.zwdsj.code.generator.ICodeGenerator;
import com.thtf.zwdsj.code.generator.impl.ComplexConfigCodeGenerator;
import com.thtf.zwdsj.code.generator.model.CodeGeneratorModel;

import java.util.Arrays;
import java.util.List;

/**
 * 测试代码生成器类
 *
 * @author tiankafei
 */
public class TestCodeGeneratorMain {

    public static void main(String[] args) {
        ICodeGenerator codeGenerator = new ComplexConfigCodeGenerator();

        // 数据中台的基础服务
        CodeGeneratorModel codeGeneratorModel = getCodeGeneratorModel();
        codeGenerator.execute(codeGeneratorModel);
    }

    public static CodeGeneratorModel getCodeGeneratorModel() {
        CodeGeneratorModel codeGeneratorModel = new CodeGeneratorModel();
        codeGeneratorModel.setModuleName("expressiondesignbasics");
        String projectPath = System.getProperty("user.dir");
        codeGeneratorModel.setOutputDir(projectPath + "/system-manage-service/src/main/java/");
        codeGeneratorModel.setUrl("jdbc:mysql://10.10.60.119:3306/basics?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8");
        codeGeneratorModel.setUsername("thtf");
        codeGeneratorModel.setPassword("THTF_tjy_thtf");
        List<String> tableNameList = Arrays.asList("RULE_DESIGN_CALCULATE", "RULE_DESIGN_SKIP","RULE_DESIGN_VERIFY");
        codeGeneratorModel.setTableNameList(tableNameList);
        codeGeneratorModel.setTablePrefix("RULE_");
        codeGeneratorModel.setMapperXmlPath(projectPath + "/system-manage-service/src/main/resources/mapper");

        return codeGeneratorModel;
    }

}
